#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char *compress(char *src)
{
	char *s = (char *)malloc(strlen(src) + 1);
	if (s != NULL) 
    {
		int len = strlen(src);
		int k = 0;
		for (int i = 0, j = 0; j < len; i = j) {
			int num = 0;
			while (src[i] == src[j]) {
				j++;
				num++;
			}
			if (num < 3) {
				for (int q = 0; q < num; q++) {
					s[k++] = src[i];
				}
			} else if (num >= 3 && num <= 9) {
				s[k++] = src[i];
				s[k++] = num + '0';
			} else if (num > 9) {
				s[k++] = src[i];
				s[k++] = num / 10 + '0';
				s[k++] = num % 10 + '0';

			}
		}
		s[k] = '\0';
	}
	return s;
}
int main()
{
	char src[100];
	scanf("%s",src);

	char *ps = compress(src);
	
	puts(ps);
	return 0;
}